Skip to content

Update get_repo_attribute to take into account that attribute value can be 0 byte value (empty)#13

Merged
ocaisa merged 1 commit intoEESSI:mainfrom
boegel:fix_get_repo_attribute
Feb 5, 2026
Merged

Update get_repo_attribute to take into account that attribute value can be 0 byte value (empty)#13
ocaisa merged 1 commit intoEESSI:mainfrom
boegel:fix_get_repo_attribute

Conversation

@boegel
Copy link
Contributor

@boegel boegel commented Feb 5, 2026

Fix for eessi check crashing when attribute value could not be determined:

$ attr -g ncleanup24 /cvmfs/software.eessi.io
Attribute "ncleanup24" had a 0 byte value for /cvmfs/software.eessi.io:

@boegel boegel added bug Something isn't working check labels Feb 5, 2026
Copy link
Member

@ocaisa ocaisa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ocaisa ocaisa merged commit f12b38c into EESSI:main Feb 5, 2026
12 checks passed
@boegel
Copy link
Contributor Author

boegel commented Feb 6, 2026

Just to confirm, this fixes the bug we saw on Leonardo, eessi check doesn't crash anymore now, it just reports:

    ❌ ERROR Revision (client):  UNKNOWN

and

        ❌ ERROR Number of cache cleanups in last 24h:  UNKNOWN

Without this fix, it went down hard:

Details
$ eessi check
📦 Checking for EESSI repositories...
    ✅ OK /cvmfs/dev.eessi.io is available
    ✅ OK /cvmfs/riscv.eessi.io is available
    ✅ OK /cvmfs/software.eessi.io is available

🔎 Inspecting EESSI repository software.eessi.io...
    ✅ OK /cvmfs/software.eessi.io is available
    ℹ Revision (client):
    💻 Client cache:
        ℹ Path to client cache directory: /var/lib/cvmfs/shared
        ℹ Shared cache: yes
        ℹ Client cache quota limit: 4.8828125 GiB
        ❌ ERROR Required field 'Cache Usage' not found!
╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────── Traceback (most recent call last) ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ /leonardo/home/userexternal/khoste00/venv-py311-eessi-cli/lib64/python3.11/site-packages/eessi/cli/check.py:282 in check                                                                                                                                                     │
│                                                                                                                                                                                                                                                                              │
│   279 │                                                                                        ╭────────── locals ──────────╮                                                                                                                                                │
│   280 │   repo = EESSI_SOFTWARE_REPO                                                           │ help = None                │                                                                                                                                                │
│   281 │   rich_print(f":magnifying_glass_tilted_right: Inspecting EESSI repository {repo}...") │ repo = 'software.eessi.io' │                                                                                                                                                │
│ ❱ 282 │   check_repo(repo=repo)                                                                ╰────────────────────────────╯                                                                                                                                                │
│   283                                                                                                                                                                                                                                                                        │
│                                                                                                                                                                                                                                                                              │
│ /leonardo/home/userexternal/khoste00/venv-py311-eessi-cli/lib64/python3.11/site-packages/eessi/cli/check.py:246 in check_repo                                                                                                                                                │
│                                                                                                                                                                                                                                                                              │
│   243 │   │                                                                                                                                                                                                                                                                  │
│   244 │   │   for other_check in specs.get('other', []):                                                                                                                                                                                                                     │
│   245 │   │   │   if callable(other_check):                                                                                                                                                                                                                                  │
│ ❱ 246 │   │   │   │   other_check(repo, indent_level=2)                                                                                                                                                                                                                      │
│   247 │   │   │   else:                                                                                                                                                                                                                                                      │
│   248 │   │   │   │   raise ValueError(f"{other_check} is not callable?!")                                                                                                                                                                                                   │
│   249                                                                                                                                                                                                                                                                        │
│                                                                                                                                                                                                                                                                              │
│ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────── locals ──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮                                        │
│ │            cmd = 'cvmfs_config stat -v software.eessi.io'                                                                                                                                                                         │                                        │
│ │          descr = 'Client cache'                                                                                                                                                                                                   │                                        │
│ │      exit_code = 1                                                                                                                                                                                                                │                                        │
│ │          field = 'Cache Usage'                                                                                                                                                                                                    │                                        │
│ │   grouped_keys = {                                                                                                                                                                                                                │                                        │
│ │                  │   'Client cache': {                                                                                                                                                                                            │                                        │
│ │                  │   │   'sigil': 'computer',                                                                                                                                                                                     │                                        │
│ │                  │   │   'keys': ['CVMFS_CACHE_DIR', 'CVMFS_SHARED_CACHE', 'CVMFS_QUOTA_LIMIT'],                                                                                                                                  │                                        │
│ │                  │   │   'stat_fields': ['Cache Usage'],                                                                                                                                                                          │                                        │
│ │                  │   │   'other': [<function check_cache_cleanups at 0x150071f863e0>]                                                                                                                                             │                                        │
│ │                  │   },                                                                                                                                                                                                           │                                        │
│ │                  │   'Server/proxy settings': {'sigil': 'globe_showing_europe-africa', 'keys': ['CVMFS_SERVER_URL', 'CVMFS_HTTP_PROXY', 'CVMFS_USE_GEOAPI']},                                                                     │                                        │
│ │                  │   'Other': {'sigil': 'information_desk_person', 'keys': ['CVMFS_CLIENT_PROFILE']}                                                                                                                              │                                        │
│ │                  }                                                                                                                                                                                                                │                                        │
│ │            key = 'CVMFS_QUOTA_LIMIT'                                                                                                                                                                                              │                                        │
│ │          regex = re.compile('^Cache Usage:(?P<value>.*)', re.MULTILINE)                                                                                                                                                           │                                        │
│ │           repo = 'software.eessi.io'                                                                                                                                                                                              │                                        │
│ │      repo_path = '/cvmfs/software.eessi.io'                                                                                                                                                                                       │                                        │
│ │            res = None                                                                                                                                                                                                             │                                        │
│ │       revision = ''                                                                                                                                                                                                               │                                        │
│ │        setting = 'Client cache quota limit'                                                                                                                                                                                       │                                        │
│ │ setting_values = {'CVMFS_CACHE_DIR': '/var/lib/cvmfs/shared', 'CVMFS_SHARED_CACHE': 'yes', 'CVMFS_QUOTA_LIMIT': '5000'}                                                                                                           │                                        │
│ │          specs = {'sigil': 'computer', 'keys': ['CVMFS_CACHE_DIR', 'CVMFS_SHARED_CACHE', 'CVMFS_QUOTA_LIMIT'], 'stat_fields': ['Cache Usage'], 'other': [<function check_cache_cleanups at 0x150071f863e0>]}                      │                                        │
│ │    stat_output = ''                                                                                                                                                                                                               │                                        │
│ │         status = 'INFO'                                                                                                                                                                                                           │                                        │
│ │         stderr = ''                                                                                                                                                                                                               │                                        │
│ │          value = '4.8828125 GiB'                                                                                                                                                                                                  │                                        │
│ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯                                        │
│                                                                                                                                                                                                                                                                              │
│ /leonardo/home/userexternal/khoste00/venv-py311-eessi-cli/lib64/python3.11/site-packages/eessi/cli/check.py:167 in check_cache_cleanups                                                                                                                                      │
│                                                                                                                                                                                                                                                                              │
│   164 │   if ncleanup24 == UNKNOWN:                                                            ╭──────────────────────── locals ─────────────────────────╮                                                                                                                   │
│   165 │   │   status = ERROR                                                                   │ indent_level = 2                                        │                                                                                                                   │
│   166 │   else:                                                                                │          msg = 'Number of cache cleanups in last 24h: ' │                                                                                                                   │
│ ❱ 167 │   │   ncleanup24 = int(ncleanup24)                                                     │   ncleanup24 = ''                                       │                                                                                                                   │
│   168 │   │                                                                                    │         repo = 'software.eessi.io'                      │                                                                                                                   │
│   169 │   │   if ncleanup24 > 24:                                                              ╰─────────────────────────────────────────────────────────╯                                                                                                                   │
│   170 │   │   │   status = WARNING                                                                                                                                                                                                                                           │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
ValueError: invalid literal for int() with base 10: ''

@boegel boegel deleted the fix_get_repo_attribute branch February 6, 2026 10:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working check

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants